@import '@/styles/utils.scss';

.pageCont {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px 40px;
}

.header {
  padding: 20px 0;
  background-image: url('./img/bg.png');
  background-size: cover;
  background-repeat: no-repeat;
  border-radius: 12px;
  margin-bottom: 24px;
  padding: 30px 40px;
  position: relative;
  overflow: hidden;

}

.title {
  font-size: 28px;
  font-weight: 600;
  color: #FFFFFF;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 14px;
  color: #B0B0B0;
}

.searchContainer {
  position: relative;
  margin-bottom: 24px;

  .searchInput {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    background-color: #fff;
    color: rgba(0, 0, 0, 0.8);
    height: 48px;

    :global(.dark) & {
      background-color: #2E3033;
      border-color: rgba(255, 255, 255, 0.1);
      color: rgba(255, 255, 255, 0.8);
    }

    &:focus ,&:hover{
      border-color: rgba(0, 0, 0);
      box-shadow: 0px 0px 0px 5px rgba(0,0,0, 0.08);;
      border-width: 1px;

      :global(.dark) & {
        border-color: rgba(255, 255, 255, 0.3);
        box-shadow: 0px 0px 0px 5px rgba(255, 255, 255, 0.08);;
        border-width: 1px;
      }
    }
  }

  .searchIcon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(0, 0, 0, 0.5);
    width: 16px;
    height: 16px;

    :global(.dark) & {
      color: rgba(255, 255, 255, 0.5);
    }
  }
}

.searchInput {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 14px;
  color: #111827;

  &::placeholder {
    color: #9CA3AF;
  }

  :global(.dark) & {
    color: #E5E7EB;

    &::placeholder {
      color: #6B7280;
    }
  }
}

.providersGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 16px;
}

.providerCard {
  background: #FFFFFF;
  border-radius: 8px;
  border: 1px solid #EEEEEE;
  transition: all 0.2s ease;
  :global(.dark) & {
    background: #292A2C;
    border-color: #292A2C;
  }

  &:hover {
    box-shadow: 0px 0px 24px 0px rgba(196, 199, 202, 0.5);
    :global(.dark) & {
      background: #2E2F32;
      box-shadow: none;
    }
  }
}

.providerCardDrpOpen {
  box-shadow: 0px 0px 24px 0px rgba(196, 199, 202, 0.5);
  :global(.dark) & {
    background: #2E2F32;
    border-color: #292A2C;
    box-shadow: none;
  }
}

.providerHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 16px;
  border-bottom: 1px solid #EAEAEA;
  :global(.dark) & {
    border-color: #333333;
  }
}

.cardFooter {
  position: relative;
}

.providerInfo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.providerIcon {
  font-size: 18px;
  margin-right: 6px;

  img {
    width: 32px;
  }
}

.providerName {
  font-weight: 500;
  font-size: 20px;
  color: #111827;
  line-height: 1;

  :global(.dark) & {
    color: #E5E7EB;
  }
}

.statusDot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #1ED760;
  display: inline-block;
}

.modelCount {
  font-size: 13px;
  color: #6B7280;
  display: flex;
  align-items: center;
  gap: 4px;

  :global(.dark) & {
    color: #9CA3AF;
  }
}

.modelCountBottom {
  position: relative;
  font-size: 13px;
  color: #8F8F8F;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  overflow: hidden;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  display: inline-flex;
  &:hover {
    color: #151515;
  }

  :global(.dark) & {
    color: #9CA3AF;
    border-color: #3F4245;

    &:hover {
      color: #fff;
    }
  }
}

.modelCountBottomColor {
  color: #151515;

  :global(.dark) & {
    color: #fff;
  }
}

.chevron {
  opacity: 0.6;
  transition: transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chevronOpen {
  transform: rotate(180deg);
}

.modelList {
  position: absolute;
  z-index: 2;
  background-color: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  width: 300px;
  margin-top: 4px;
  padding: 8px 0;
  width: 100%;
  left: 0;
  top: 100%;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  animation: fadeIn 0.2s ease forwards;
  height: 208px;
  overflow-y: auto;

  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  :global(.dark) & {
    background-color: #2E3033;
    border-color: #3F4245;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
  }
}

.modelItem {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  margin: 0 8px;
  color: #374151;

  :global(.dark) & {
    color: #BDBDBD;
  }

  &:hover {
    background: #F3F3F3;
    border-radius: 8px;

    :global(.dark) & {
      background: #3F4043;
      color: #fff;
    }
  }
}

.modelControls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modelName {
  font-size: 13px;


  // :global(.dark) & {
  //   color: #D1D5DB;
  // }
}

/* Switch styles */
.apiKeyButton {
  display: flex;
  align-items: center;
  justify-content: center;
  // background-color: #fff;
  font-size: 12px;
  font-weight: 400;
  padding: 5px 16px;
  border-radius: 8px;
  border: 1px solid #EEEEEE;
  color: #151515;
  min-height: 32px;

  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  gap: 4px;
  line-height: 1;

  i {
    margin-right: 4px;
  }

  &:hover {
    background: #F7F7F7;
  }

  :global(.dark) & {
    // background: #292A2C;
    color: #fff;
    border: 1px solid #3F4245;

    &:hover {
      background: #3F4043;
      border-color: #3F4043;
    }
  }
}

.switchRoot {
  width: 36px;
  height: 20px;
  background-color: #E5E7EB;
  border-radius: 9999px;
  position: relative;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);

  &[data-state='checked'] {
    background-color: #1ED760;
  }

  :global(.dark) & {
    background: rgb(88, 89, 90);

    &[data-state='checked'] {
      background: rgb(249, 248, 246);
    }
  }
}

.switchThumb {
  display: block;
  width: 16px;
  height: 16px;
  background-color: white;
  border-radius: 9999px;
  box-shadow: 0 2px 2px rgba(0, 0, 0, 0.1);
  transition: transform 100ms;
  transform: translateX(2px);
  will-change: transform;

  &[data-state='checked'] {
    transform: translateX(18px);

    :global(.dark) & {
      background-color: #000;
    }
  }
}